<template>
  <el-row class="tac">
    <el-col :span="12">
      <el-menu default-active="2" class="el-menu-vertical-demo">
        <router-link to="/home">
          <el-menu-item index="0">
            <i class="el-icon-setting"></i>
            <span slot="title">首页</span>
          </el-menu-item>
        </router-link>
        <template v-for="item in items">
          <el-submenu v-if="item.children" :index="item.path" :key="item.path">
            <template slot="title">
              <i :class="'el-icon' + item.icon"></i>
              <span slot="title">{{ item.name }}</span>
            </template>
            <router-link
              v-for="(citem, cindex) in item.children"
              :to="citem.path"
              :key="cindex"
            >
              <el-menu-item :index="citem.path">
                <span slot="title">{{ citem.name }}</span>
              </el-menu-item>
            </router-link>
          </el-submenu>
        </template>
      </el-menu>
    </el-col>
  </el-row>
</template>
<script>
export default {
  data() {
    return {
      items: [
        {
          icon: "fa-money",
          name: "资金管理",
          path: "fundlist",
          children: [{ path: "fundlist", name: "资金流水" }],
        },
        {
          icon: "fa-asterisk",
          name: "信息管理",
          path: "personal",
          children: [{ path: "personal", name: "个人信息" }],
        },
      ],
    };
  },
};
</script>
<style lang="less" scoped>
.el-menu-vertical-demo {
  width: 200px;
  min-height: calc(100vh - 50px);
}
</style>